package com.example.strategy.enums;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.Getter;


/**
 * @author panghu
 * @version 1.0.0
 * @createTime 2023年07月26日 21:42:00
 * @Description
 */
@Getter
public enum VipTypeEnum {

    NORMAL("普通会员", "normal", "nUser"),
    LIFELONG("永久会员", "lifeLong", "lUser"),
    MONTH("月会员", "month", "mUser"),
    SEASON("季度会员", "season", "sUser"),
    YEAR("年会员", "year", "yUser");


    String name;

    String classPre;

    // 路由type
    String type;

    VipTypeEnum(String name, String classPre, String type) {
        this.name = name;
        this.classPre = classPre;
        this.type = type;
    }

    public static VipTypeEnum getName(String name) {
        if (StringUtils.isNotBlank(name)) {
            for (VipTypeEnum enu : values()) {
                if (enu.name.equals(name)) {
                    return enu;
                }
            }
        }
        return null;
    }

    public static VipTypeEnum getByType(String type) {
        if (StringUtils.isNotBlank(type)) {
            for (VipTypeEnum enu : values()) {
                if (enu.type.equals(type)) {
                    return enu;
                }
            }
        }
        return null;
    }

}
